package com.example.demo.test;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class LimitController {


    @Autowired
    private LimitService limitService;

    //方法一: 使用计数器
    @GetMapping("/counter")
    public String limitInterface1() throws Exception {
        return limitService.visitCounter();
    }

    //方法二: 使用semaphore
    @GetMapping("/semaphore")
    public String limitInterface() throws Exception{
           return limitService.visitSemaphore();
        }
}
